<?php

/**
 * @author Dingo
 */
class Form_Kontakt {

    public static function generuj() {
        $formularz = '<div class="form">';
        $Config = array(
            'size' => 35,
            'css_error' => 'fields_error',
            'template_open' => '<div class="form_row">',
            'template_label' => '<label>|LABEL|</label>',
            'template_field' => '|FIELD|',
            'template_error' => '<BR><font class="error">- |ERROR|</font>',
            'template_close' => '</div>',
            'template_line' => "\n",
            'template_field_one' => '<div class="form_row">|LABEL||FIELD|</div>'
        );


        $Form = & new Form_AuriumForm($Config);
        $formularz .= $Form->OpenForm(array('m' => 'p',
                    'action' => '/kontakt/akcja,wyslij.html'));

        $mail = array(
            'label' => 'email:',
            'type' => 'text',
            'name' => 'email',
            'value' => htmlspecialchars($_POST['email']),
            'css' => 'main_input'
        );

        $imie = array(
            'label' => 'Imie i Nazwisko',
            'type' => 'text',
            'name' => 'fullname',
            'value' => htmlspecialchars($_POST['fullname']),
            'css' => 'main_input'
        );

        $Contact = array(
            'label' => 'Problem',
            'type' => 'selectbox',
            'name' => 'contact',
            'items' => array('sponsoring' => 'Sponsoring', 'partners' => 'Współpraca', 'tech' => 'Sprawy Techniczne', 'reklama' => 'Reklama'),
            'selected' => htmlspecialchars($_POST['contact']),
            'css' => 'main_input'
        );

        $Tresc = array(
            'label' => 'Treść',
            'type' => 'textarea',
            'name' => 'tresc',
            'value' => htmlspecialchars($_POST['tresc']),
            'css' => 'main_textarea',
            'size' => array(35, 6),
        );

        $checkbox = array(
            'type' => 'checkbox',
            'name' => 'daneosobowe',
            'value' => 'yes',
            'text' => 'Zgadzam się na przetwarzanie moich danych osobowych',
            'text_clickable' => true,
            'selected' => $_POST['daneosobowe'],
            );

        $checkbox2 = array(
            'type' => 'checkbox',
            'name' => 'regulamin',
            'value' => 'yes',
            'text' => 'Akceptuje regulamin serwisu',
            'label' => 'hghg',
            'text_clickable' => true,
            'selected' => $_POST['regulamin'],
        );

        $Buttons = array(
            'type' => 'button',
            'subtype' => array('reset','submit'),
            'value' => array('Resetuj','Wyślij'),
            'css' => 'submit',
            'alone' => true
        );
        
        $Form->SetData(array($mail, $imie, $Contact, $Tresc, $checkbox, $checkbox2));
        $formularz .= $Form->ShowFields();
        $formularz .= $Form->OneField($Buttons);
        $formularz .= $Form->CloseForm();
        $formularz .= '</div>';
        return $formularz;
    }

}

?>
